package com.xinziruo.richclient.engine.impl;

import com.xinziruo.richclient.engine.PayloadSource;

/**
 * 
 * @author loudyn
 *
 */
public class NumbersPayloadSource implements PayloadSource {

	private int from, to, step, current;

	public NumbersPayloadSource(int from, int to, int step) {
		this.from = from;
		this.to = to;
		this.step = step;
		
		reset();
	}

	@Override
	public boolean hasNext() {
		current += step;
		return current <= to;
	}

	@Override
	public void reset() {
		current = from - step;
	}

	@Override
	public String getPayload() {
		return Integer.toString(current);
	}

}
